home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Softice Tuts / si-ug-chapter09.rtf < prev    next >
Text File  |  2000-05-25  |  6KB  |  151 lines

  1. CHAPTER 9 - Back Trace Ranges
  2.  
  3.      09.01 Introduction
  4.      09.02 Using Back Trace Ranges
  5.      09.03 Special Notes
  6.  
  7. 09.01 Introduction
  8.  
  9.      Soft-ICE can collect instruction information in a back trace history
  10.      buffer as your program executes. These instructions can then be
  11.      displayed after a bug has occurred. This allows you to go back and
  12.      retrace a program's action to determine the actual flow of
  13.      instructions preceding a break point.
  14.  
  15.      Instruction information is collected on accesses within a specified
  16.      address range, rather than system wide. The ranges can be from 1 byte
  17.      to 1 megabyte, so if desired, complete system information can be
  18.      obtained. Using specific ranges rather than collecting all
  19.      instructions is useful for two reasons:
  20.  
  21.      1. The back trace history buffer is not cluttered by extraneous
  22.      information that you are not interested in. For example, you may not
  23.      be interested in interrupt activity and execution within MSDOS.
  24.  
  25.      2. Back trace ranges degrade system performance while they are active.
  26.      By limiting the range to an area that you are interested in, you can
  27.      improve system performance greatly.
  28.  
  29.      Soft-ICE has two methods of utilizing the instructions in the back
  30.      trace history buffer:
  31.  
  32.      1. The SHOW command allows you to display instructions from the back
  33.      trace history buffer. You must specify how many instructions you wish
  34.      to go back in the buffer.
  35.  
  36.      2. The TRACE command allows you to go back and replay instructions
  37.      from the back trace history buffer, This way you can see the
  38.      instruction flow within the context of the surrounding program code or
  39.      source code.
  40.  
  41. 09.02 Using Back Trace Ranges
  42.  
  43.      To use back trace ranges you must do the following:
  44.  
  45.      1. Allocate a back trace history buffer of the desired size by
  46.      inserting the /TRA switch on the S-ICE.EXE line in CONFIG.SYS. For
  47.      example, to create a back trace buffer of 100K you might have the
  48.      following line in your CONFIG.SYS file:
  49.  
  50.      DEVICE = S-ICE.EXE 100
  51.  
  52.      A back trace history buffer of 10K is allocated by default. If this is
  53.      suitable for your needs you do not have to allocate a larger buffer.
  54.      The history buffer size is only limited by the amount of extended
  55.      memory available.
  56.  
  57.      2. Enable back trace ranges by creating a memory range break point
  58.      with the T or TW verb. For example:
  59.  
  60.      BPR 1000:0 2000:0 T
  61.  
  62.      The T and TW verbs do not cause break points instead they log
  63.      instruction information that can be displayed later with the SHOW or
  64.      TRACE commands.
  65.  
  66.      3. Set any other break points if desired.
  67.  
  68.      4. Exit from Soft-ICE with the X command.
  69.  
  70.      5. After a break point has occurred, or you have popped Soft-ICE up
  71.      with the hot key, you can display instructions in the buffer with the
  72.      SHOW command. For example, to go back 50 instructions in the buffer
  73.      and display instructions type:
  74.  
  75.      SHOW 50
  76.  
  77.      6. To replay a series of instructions you must first enter trace
  78.      simulation mode with the TRACE command. To begin replaying the
  79.      sequence of instructions starting back 50 in the buffer type:
  80.  
  81.      TRACE 50
  82.  
  83.      7. After you have entered trace simulation mode, you can trace through
  84.      the sequence of instructions by using the XT, XP, or XG commands. This
  85.      allows you to re-enact the program flow. For example, you can single
  86.      step through the sequence of instructions in the buffer, starting at
  87.      the instruction specified by the TRACE command, by typing:
  88.  
  89.      XT
  90.      XT
  91.      .
  92.      .
  93.      .
  94.      XT
  95.  
  96.      The XT command single steps through the back trace history buffer.
  97.  
  98.      The XP command program steps through the back trace history buffer.
  99.  
  100.      The XG command goes to an address in the back trace history buffer.
  101.  
  102.      8. To exit from trace simulation mode type:
  103.  
  104.      TRACE OFF
  105.  
  106.      9. To reset the back trace history buffer, use the X command.
  107.  
  108. 09.03 Special Notes
  109.  
  110.      While in trace simulation mode, most Soft-ICE commands work as normal,
  111.      including displaying the memory map, and displaying and editing data.
  112.      The exceptions are:
  113.  
  114.      1. Register information is not logged in the back trace history
  115.      buffer, so the register values do not change as you trace through the
  116.      buffer, except for CS and IP.
  117.  
  118.      2. Commands that normally exit from Soft-ICE do not work while in
  119.      trace simulation mode. These are X, T, P, G, EXIT.
  120.  
  121.      As you peruse instructions from the back trace history buffer with the
  122.      SHOW and TRACE commands, you may notice peculiarities in instruction
  123.      execution. These are caused by jumps in and out of the specified
  124.      range. These usually occur at jumps, calls, returns and entry points.
  125.      When you have a hang problem or other difficult bug that requires back
  126.      trace ranges, you must often use very large ranges in order to narrow
  127.      the scope of the problem. Once you have a better idea of the specific
  128.      problem area, you go to smaller ranges.
  129.  
  130.      Large back trace ranges are often very slow. When using large ranges
  131.      you are usually trying to get a general idea where the problem is.
  132.      Soft-ICE has a special 'COARSE' mode for doing large ranges. This
  133.      speeds up the ranges a factor of three or more, but limits the amount
  134.      of instructions in the history buffer.
  135.  
  136.      Coarse mode only collects instructions that do a memory write within
  137.      the specified range. As you are replaying instructions with trace
  138.      simulation mode after a 'coarse' range you will notice that the flow
  139.      skips around rather than sequentially executing instructions.
  140.  
  141.      Coarse ranges work best for large ranges and tend to be less effective
  142.      for small ranges.
  143.  
  144.      To enable a 'coarse' back trace range, use the BPR command with the TW
  145.      verb instead of the T verb. For example:
  146.  
  147.      BPR 1000:0 2000:0 TW
  148.  
  149.      For further information on back trace ranges see the command
  150.      descriptions for : SHOW, TRACE, XT, XP, XG, XRSET, BPR
  151.